package com.mall.b2c.domain.member;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;

import com.mall.common.domain.BaseEntity;

/**
 * 站内通知--接收者（member为空，表示该消息为系统消息，接收者为所有人）
 * 
 * @author lzx
 */
@Entity
@Table(name = "b2c_site_notice")
public class SiteNoticeDomain extends BaseEntity {

	private static final long serialVersionUID = 5800951622665517911L;

	private String sender; //操作人
	private Boolean isRead; //是否阅读
	private Boolean isDelete; //是否删除
	private MemberDomain member; //接收者
	private SiteNoticeTextDomain noticeText; //消息
	
	@PrePersist
	public void prePersist(){
		if(isRead == null){
			isRead = false;
		}
		if(isDelete == null){
			isDelete = false;
		}
	}
	
	public String getSender() {
		return sender;
	}

	public void setSender(String sender) {
		this.sender = sender;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public SiteNoticeTextDomain getNoticeText() {
		return noticeText;
	}

	public void setNoticeText(SiteNoticeTextDomain noticeText) {
		this.noticeText = noticeText;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public MemberDomain getMember() {
		return member;
	}

	public void setMember(MemberDomain member) {
		this.member = member;
	}

	public Boolean getIsRead() {
		return isRead;
	}

	public void setIsRead(Boolean isRead) {
		this.isRead = isRead;
	}

	public Boolean getIsDelete() {
		return isDelete;
	}

	public void setIsDelete(Boolean isDelete) {
		this.isDelete = isDelete;
	}
	
}
